﻿<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Collections" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="TarreOA.TarreOABLL" %>
<%@ Import Namespace="TarreOA.TarreOAModels  " %>

<script runat="server">

    private int cgid;
    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Request["cgid"] != null)
            {
                cgid = int.Parse(Request["cgid"]);
                this.FindForDisplay();
                ViewState["cgid"] = cgid;
            }
        } 
    }

    protected void FindForDisplay()
    {
        UserCommunicationGrouptbService ucgs = new UserCommunicationGrouptbService();
        UserCommunicationGrouptb ucg = ucgs.findByComGroupId(cgid);
        if (ucg != null)
        {
            this.LblGroupName.Text = ucg.ComGroupName;
            this.LblGroupCreateTime.Text = ucg.CreateTime.ToString();
        }
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        if (!"".Equals(this.TxtNewGroupName.Text.Trim()))
        {
            if (ViewState["cgid"] != null)
            {
                cgid = (int)ViewState["cgid"]; 
            }   
            UserCommunicationGrouptbService ucgService = new UserCommunicationGrouptbService();
            ucgService.updateComGroupInfoByGroupId(cgid, this.TxtNewGroupName.Text);
            ScriptManager.RegisterClientScriptBlock(Page, GetType(), "", "window.parent.leftFrame.location.reload();", true);
            this.FindForDisplay();
            this.TxtNewGroupName.Text = "";  
            ViewState["cgid"] = cgid; 
        }
    }
    
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <link href="../CSS/TableStyle.css" rel="stylesheet" />
</head>
<body bgcolor="#EEEEEE">
    <form id="form1" runat="server">
    <div>
        <table style="width: 496px" align="center" cellpadding="1" cellspacing="1" bgcolor="black">
            <tr>
                <td align="center" colspan="2" style="height: 30px" background="../CSS/Snap1.jpg">
                    <asp:Image ID="Image1" runat="server" Height="21px" ImageAlign="AbsMiddle" ImageUrl="~/images/updateComGroup.png"
                        Width="31px" />
                    <asp:Label ID="Label3" runat="server" Height="13px" Text="编辑分组信息" Width="132px"></asp:Label></td>
            </tr>
            <tr>
                <td style="width: 73px">
                    <asp:Label ID="Label1" runat="server" Text="分组原名称:" Width="98px" Font-Size="Smaller"></asp:Label></td>
                <td style="width: 700px">
                    <asp:Label ID="LblGroupName" runat="server" Font-Bold="False" Width="377px" Font-Size="Smaller"></asp:Label></td>
            </tr>
            <tr>
                <td style="width: 73px">
                    <asp:Label ID="Label2" runat="server" Text="分组创建时间:" Width="106px" Font-Size="Smaller"></asp:Label></td>
                <td style="width: 700px">
                    <asp:Label ID="LblGroupCreateTime" runat="server" Font-Bold="False"
                        Width="377px" Font-Size="Smaller"></asp:Label></td>
            </tr>
            <tr>
                <td style="width: 73px">
                    <asp:Label ID="Label6" runat="server" Text="分组新名称:" Width="104px" Font-Size="Smaller"></asp:Label></td>
                <td style="width: 700px">
                    <asp:TextBox ID="TxtNewGroupName" runat="server" BackColor="#FFFFC0" Width="371px"></asp:TextBox></td>
            </tr>
            <tr>
                <td align="center" colspan="2" background="../CSS/Snap1.jpg" height="30px">
                    <asp:Button ID="Button1" runat="server" Text="确定" Width="80px" OnClick="Button1_Click" /></td>
            </tr>
        </table>
    
    </div>
    </form>
</body>
</html>
